package cn.iocoder.yudao.module.bill.dal.mysql.account;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bill.dal.dataobject.account.AccountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.bill.controller.admin.account.vo.*;

/**
 * 账户信息 Mapper
 *
 * @author mmciel
 */
@Mapper
public interface AccountMapper extends BaseMapperX<AccountDO> {

    default PageResult<AccountDO> selectPage(AccountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccountDO>()
                .eqIfPresent(AccountDO::getAccountId, reqVO.getAccountId())
                .likeIfPresent(AccountDO::getAccountName, reqVO.getAccountName())
                .likeIfPresent(AccountDO::getAccountOwner, reqVO.getAccountOwner())
                .likeIfPresent(AccountDO::getAccountRemark, reqVO.getAccountRemark())
                .betweenIfPresent(AccountDO::getAccountStartTime, reqVO.getAccountStartTime())
                .betweenIfPresent(AccountDO::getAccountStopTime, reqVO.getAccountStopTime())
                .eqIfPresent(AccountDO::getHasWater, reqVO.getHasWater())
                .eqIfPresent(AccountDO::getHasEnable, reqVO.getHasEnable())
                .eqIfPresent(AccountDO::getMoneyOwner, reqVO.getMoneyOwner())
                .eqIfPresent(AccountDO::getAccountType, reqVO.getAccountType())
                .likeIfPresent(AccountDO::getBankName, reqVO.getBankName())
                .eqIfPresent(AccountDO::getBankCard, reqVO.getBankCard())
                .eqIfPresent(AccountDO::getOrderNum, reqVO.getOrderNum())
                .eqIfPresent(AccountDO::getLogicParentAccount, reqVO.getLogicParentAccount())
                .eqIfPresent(AccountDO::getRemarkBalance, reqVO.getRemarkBalance())
                .betweenIfPresent(AccountDO::getRemarkBalanceTime, reqVO.getRemarkBalanceTime())
                .likeIfPresent(AccountDO::getExtParam, reqVO.getExtParam())
                .betweenIfPresent(AccountDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(AccountDO::getOrderNum)
                .orderByDesc(AccountDO::getCreateTime));
    }

}